;;;;;;;;;;;;;;;;;;;;  php setting  ;;;;;;;;;;;;;;;;;;;;
(require 'php-mode)
(require 'mmm-mode)
(setq php-mode-force-pear t)
(autoload 'mmm-mode "mmm-mode" "Multiple Major Modes" t)
(autoload 'mmm-parse-buffer "mmm-mode" "Automatic MMM-ification" t)
(define-key php-mode-map
  [menu-bar php php-run]
  '("Run the PHP Program" . php-run))
(defun php-run ()
  (interactive)
  (shell-command
   (concat (concat emax-php-command " -f \"")
           (read-file-name "Input file name: ")
           "\""))
  )
(setq mmm-global-mode 'maybe)
(mmm-add-group
 'php-in-html
 '(
   (html-php-tagged
    :submode php-mode
    :front "<\\?"
    :back "\\?>"
    :include-back t)))
(add-to-list 'auto-mode-alist '("\\.php[34]?\'" . html-mode))

;;;;;;;;;;;;;;;;;;;;  hook  ;;;;;;;;;;;;;;;;;;;;
(add-hook 'php-mode-hook
          (lambda()
            (require 'php-completion)
            (hs-minor-mode)
            (turn-on-font-lock)
            (php-completion-mode t)
            (define-key php-mode-map (kbd "C-c p") 'phpcmp-complete)
            (when (require 'auto-complete nil t)
              (make-variable-buffer-local 'ac-sources)
              (add-to-list 'ac-sources 'ac-source-php-completion)
              (define-key ac-complete-mode-map "\M-n" 'ac-next)
              (define-key ac-complete-mode-map "\M-p" 'ac-previous)
              (define-key ac-complete-mode-map "\r" 'ac-complete)
              (auto-complete-mode t))))

;;;;;;;;;;;;;;;;;;;;  junk  ;;;;;;;;;;;;;;;;;;;;
;;(add-hook 'php-mode-user-hook 'turn-on-font-lock)
;;(autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
;;(setq auto-mode-alist (cons '("\\.html$" . html-helper-mode) auto-mode-alist))
